package cn.wolfcode.p2p.listener;

import cn.wolfcode.p2p.base.service.ILoginInfoService;
import cn.wolfcode.p2p.bussness.service.ISystemAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

//初始化监听器 放一些需要在初始化的操作
@Component
public class InitListener implements ApplicationListener<ContextRefreshedEvent> {

    @Autowired
    private ILoginInfoService loginInfoService;

    @Autowired
    private ISystemAccountService systemAccountService;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        loginInfoService.initAdmin();

        systemAccountService.initSystemAccount();
    }
}
